package com.cskaoyan.shopping.controller;

import com.cskaoyan.mall.commons.result.ResponseData;
import com.cskaoyan.mall.commons.result.ResponseUtil;
import com.cskaoyan.shopping.dto.AllProductResponse;
import com.cskaoyan.shopping.dto.PanelDto;
import com.cskaoyan.shopping.form.PageRequest;
import com.cskaoyan.shopping.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

/**
 * @Aurhor: 王可龙
 * @DATE: 2022/10/25 19:44
 * @Package:com.cskaoyan.shopping.controller
 * @Description:
 * @Version 1.0
 */
@RestController
public class IGoodsController {

    @Autowired
    IProductService iProductService;

    @GetMapping("/shopping/goods")
    public ResponseData goods(PageRequest pageRequest) {

        AllProductResponse allProduct = iProductService.getAllProduct(pageRequest);

        return new ResponseUtil().setData(allProduct);
    }

    @GetMapping("/shopping/recommend")
    public ResponseData recommend() {
        Set<PanelDto> recommendGoods = iProductService.getRecommendGoods();
        return new ResponseUtil().setData(recommendGoods);
    }


}
